import java.lang.reflect.Proxy;

/**
 * @Author: liull
 * @Description:
 * @Date: Created in 15:41 2021/1/28
 * @Modified By:
 */
public class RpcProxyClient {

    public <T> T clientProxy(final Class<T> interfaceClass, final String host, final int port) {
        return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class[] {
                interfaceClass
        }, new RemoteInvocationHandler(host, port));
    }
}
